package com.xiaotu.spider.maoyan.pipeline;

import org.springframework.stereotype.Component;

import com.xiaotu.common.model.NeiDiBoxOfficeModel;
import com.xiaotu.common.util.Constants;
import com.xiaotu.common.util.DataRedisKeyUtils;
import com.xiaotu.spider.APipeline;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;

/**
 * NeiDiBoxOfficePipeline
 * @author wangyanlong
 * @date 2020年1月2日 上午9:40:04
 * 58921网站内地电影信息
 */
@Component("NeiDiBoxOfficePipeline")
public class NeiDiBoxOfficePipeline extends APipeline
{
    @Override
    protected void doProcess(ResultItems resultItems, Task task)
    {
    	NeiDiBoxOfficeModel tv = resultItems.get(NeiDiBoxOfficeModel.class.getName());
        if (tv == null)
            return;
        String key = DataRedisKeyUtils.getKey(Constants.DataRedisKey.NEIDI_BOXOFFICE);
        cacheHandler.hSet(key, tv.getTvName(), tv);
        //cacheHandler.setCacheTimeout(key);
    }

}
